/*
 *  Sasku.cpp
 *  Sasku
 *
 *  Created by Einar Pius on 18/07/2008.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include "Sasku.h"
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/StreamSocket.h>

using Poco::Util::Application;

Sasku::Sasku() {}

Sasku::~Sasku() {}

void Sasku::initialize(Application& self)
{
	loadConfiguration();
	Application::initialize(self);
	logger().information("Initializing Sasku.");
}

int Sasku::main(const std::vector<std::string>&)
{
	const unsigned short port = config().getInt("server.port");
	const std::string host = config().getString("server.hostname");
	logger().information("Connecting to " + host);
	Poco::Net::SocketAddress address(host, port);
	Poco::Net::StreamSocket socket(address);
	logger().information("Connected to " + host);
	logger().information("Sasku running.");
	return Application::EXIT_OK;
}

void Sasku::uninitialize()
{
	logger().information("Uninitializing Sasku.");
	Application::uninitialize();
}

POCO_APP_MAIN(Sasku)
